//
//  InstallationDetailSystemDetailForInverterModel.swift
//  ezyform
//
//  Created by MoennigQ on 17/6/21.
//  Copyright © 2021 Client.Solution Pty Ltd. All rights reserved.
//

import Foundation
import HandyJSON
import RxSwift
class InstallationDetailSystemDetailForInverterModel: NSObject, HandyJSON, Copying {
    var id: Int64 = 0//是pvd detail中此，system->Inverter数据的主键
    var inverter_brand: String = ""
    var inverter_series: String = ""
    @objc dynamic var inverter_model: String = ""
    @objc dynamic var number_inverters: Int64 = 0
    //字典中panel的id,用于修改Inverter信息上传用
    var inverter_brand_id: Int64 = 0
    //inverter的功率，单位是W
    var ac_power: Int64 = 0
    //删除标记
    var deleted_at: Bool = false
    var valid_flag: Bool = true//true,表示当前model是无效的，因为改了安装日期，可能会变成无效的
    var approved_date: String = ""//审核通过时间
    var expiry_date: String = ""//过期时间
    var tank_flag: Bool = false//tank，inverter共用；false表示是inverter，true表示是tank
    var total_power: String {
        let value: Double = Double(ac_power) * Double(number_inverters) / 1000
        if value > 0 {
            return Tool().formatAmountToStr(amount: "\(value)",maximumFractionDigits: 3, minimumFractionDigits: 0)
        }
        return ""
        
    }
    required override init() {
        
    }
    
    required init(original: InstallationDetailSystemDetailForInverterModel) {
        id = original.id
        inverter_brand = original.inverter_brand
        inverter_series = original.inverter_series
        inverter_model = original.inverter_model
        number_inverters = original.number_inverters
        inverter_brand_id = original.inverter_brand_id
        ac_power = original.ac_power
        deleted_at = original.deleted_at
    }
}
